<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: xajax.boxen_manager.php 11 2013-09-21 11:43:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 11 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:43:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require_once(DIR_WS_INCLUDES.'/xajax/xajax_core/xajax.inc.php');

function setFlag($id, $type, $status) {
	global $db;
	
	$ajax = new xajaxResponse();
	if($type == 'bs')
		$set = $db->db_query("UPDATE ".TABLE_BOXES." SET status = '".$status."' WHERE id = '".$id."' ");
		
	elseif($type == 'bn')
		$set = $db->db_query("UPDATE ".TABLE_BOXES_NAMES." SET status = '".$status."' WHERE id = '".$id."' ");
		
	if($status == 1) {
		$s = 0;
		$desc = BOX_ACTIVATE;
	} else {
		$s = 1;
		$desc = BOX_DEACTIVATE;
	}
	
	$c = '<img onclick="xajax_setFlag('.$id.', \''.$type.'\', '.$s.')" src="images/icons/status_'.$status.'.png" alt="" title="'.$desc.'" />';
	$ajax->assign('box_'.$type.'_'.$id, 'innerHTML', $c);
	
	return $ajax;
}

$xajax = new xajax();
$xajax->registerFunction('setFlag');
$xajax->processRequest();
?>